package alfred.proctice.com.recycleview;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import me.drakeet.multitype.ItemViewBinder;

/**
 * Created by Alfred on 2018/3/9.
 */

public class PictureBinder extends ItemViewBinder<String,PictureBinder.ViewHolder> {
    private Context context;
    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        context = parent.getContext();
        return new ViewHolder(inflater.inflate(R.layout.item_picture,parent,false));
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull String item) {
        GlideUtil.loadImg(context,item,holder.item_picture_img);
    }

    class ViewHolder extends RecyclerView.ViewHolder{
        public ImageView item_picture_img;
        public View item_picture_delete;
        public ViewHolder(View itemView) {
            super(itemView);
            item_picture_img = itemView.findViewById(R.id.item_picture_img);
            item_picture_delete = itemView.findViewById(R.id.item_picture_delete );
        }
    }
}
